import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const store = new Vuex.Store({
  state: {
    n:1,
    num:0
  },
  mutations: {
    incr: state => state.n++,
    decr: state => state.n--,
    incrnum: (state,num) =>  state.num += parseInt(num),
    decrnum(state,num){
      console.log(num);
      return state.num -= parseInt(num)
    },
  },
  actions: {

  },
  getters:{
    nsquare: state => state.n * state.n
  }
})

export default store;
